package VN.EDU.IMIC.DEVELOPER.DOTHANHTUNG.OOP_MVC_LV1.Calculator;

public class CalculatorModel {
	
	public boolean CheckDivideByZero(Calculator operator){
		if (operator.getB() == 0 && operator.getiOpt() == 3){
			return true;
		}
		else {
			return false;
		}
	}
	
	public boolean CheckZeroDivideZero(Calculator operator){
		if (operator.getA() == 0 && operator.getB() == 0 && operator.getiOpt() == 3){
			return true;
		}
		else {
			return false;
		}
	}
	public double Calculate(Calculator operator){
		double results = 0;
		switch (operator.getiOpt()) {
		case 1:
			return results = operator.getA() + operator.getB();
		case 2:
			return results = operator.getA() - operator.getB();
		case 3:
			return results = operator.getA() / operator.getB();
		case 4:
			return results = operator.getA() * operator.getB();
		default:
			break;
		}
		return results;
	}

}
